package main

import (
	//"gopkg.in/mgo.v2/bson"
	"fmt"
    "reflect"
"github.com/go-ego/gse"
    "strings"
)


 
 
  type User12 struct  {
        Id int
        Name string
        addr string
        ddd int
}
 type User struct  {
        Id int
        Name string
        addr string
        ddd int
        us User12
}
 
func main(){
var seg gse.Segmenter
	// Loading the default dictionary
	//seg.LoadDict()
	//seg.LoadDict("D:/GO/go/work/src/github.com/go-ego/gse/data/dict/zh/mydict.txt")
	seg.LoadDict("D:/workspace/GoWorks/src/kukukaki/test/mydict.txt")
	//seg.LoadDict(" mydict.txt")
	// strr:="的 我   很好"
	 index :=strings.Index("我的成功是abv你的", "ab")
			//dd := strings.Replace(strr, " ", "", -1)
			fmt.Println("---")
			fmt.Println(index)
	// Load the dictionary
	// seg.LoadDict("your gopath"+"/src/github.com/go-ego/gse/data/dict/dictionary.txt")

	// Text Segmentation
	text := []byte("yesyou are你的 羟苯丙酯钠,朋友,是乙醇的,朋友密码是 羟苯丙酯")
	fmt.Println(seg.Slice(text, false)) 
	sl := seg.Slice(text, false)
	
	for index := 0; index < len(sl); index++ {
		fmt.Println(len(sl[index]))
		fmt.Println(sl[index])
		if len(sl[index]) <4 {
			 sl = append(sl[:index], sl[index+1:]...)
			 index--
		}
		
	}
	fmt.Println("--------")
	for index := 0; index < len(sl); index++ {
		fmt.Println(sl[index])
	}
	//segments := seg.Segment(text)
  
	// Handle word segmentation results
	// Support for normal mode and search mode two participle,
	// see the comments in the code ToString function.
	// The search mode is mainly used to provide search engines 
	// with as many keywords as possible
	//fmt.Println(gse.ToString(segments, true)) 
}

func typeof(v interface{}) string {
    return reflect.TypeOf(v).String()
}
 